var app = getApp()

Page({
  data: {
    map_height: 580,
    longitude: 116.396,
    latitude: 39.9102,
    markers: []
  },
  onReady: function (e) {
    this.mapCtx = wx.createMapContext('historyMap')
  },
  onLoad: function (e) {
    var that = this;
    // 动态设置map的宽和高
    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          map_width: res.screenWidth,
          map_height: res.windowHeight-170
        })  
      }
    })
  },
  onShow: function (e) {
    var that = this;
    app.getLocationInfo(function (locationInfo) {
      that.setData({
        longitude: locationInfo.longitude
        , latitude: locationInfo.latitude
      })
    })
  }
})
